In [2]:
import unicodecsv
import pprint
import csv
In [3]:
csv_file_name="enrollments.csv"
In [4]:
enrolment = []
f=open(csv_file_name,'rb')
reader =unicodecsv.DictReader(f)
#reader is a itterater so loop is possible only once
print "type(reader) =",reader
#for each_row in reader:
# enrolment.append(each_row)
enrolment=list(reader) #shorthand for above two line
#close file
f.close()
print "Total no of row : ",len(enrolment),"\n\n"
#print demo data
pprint.pprint(enrolment[1])
In [5]:
data = []
with open(csv_file_name, 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter=' ', quotechar='|')
for row in reader:
data.append(row)
print "Headings :",(data[0])
print"Data :",(data[1])
In [6]:
import pandas as pd
In [7]:
enrol = pd.read_csv(csv_file_name)
In [8]:
enrol[:5]
Out[8]:
In [9]:
len(enrol["account_key"].unique()) #unique account keys
Out[9]:
In [10]:
type(enrol)
Out[10]:
In [ ]: